Data sorted incorrectly due to data contains results of formulas.
Cause:
This problem occurs because some of the selected cells contain formulas. The data may appear sorted for a moment, but the formulas recalculate and return the original values to the cells.
Solution:
Include the source cells in the sort, or use absolute references in the formulas.
Do one of the following to solve the problem:
1) Select the cells to be sorted and the source cells to which the formulas refer to include both in the sort.
2) Use absolute references in the formulas:
a) Select the cell containing a formula.
b) Press F2. (The insertion point appears at the end of the formula.)
c) Move the insertion point before the reference to be edited.
NOTE: By default, cell and range references typed in a formula are relative. A relative reference adjusts automatically when the related formula is moved. After a reference is changed to absolute, however, the reference remains fixed when the related formula is moved.
d) Type a dollar sign ($) in front of the column letter AND the row number of the reference.
EXAMPLE: The absolute reference for 'D4' is '$D$4'.
e) Press ENTER.
f) Repeat steps 2)a) through 2)e) for each formula contained in the selected cells.